Completed
Push — master ( 734acd...e65e46 )
by Pieter Epeüs
13s queued 10s
created

helpers.umd.js ➔ t   A

Complexity

Conditions 5

Size

Total Lines 1
Code Lines 1

Duplication

Lines 1
Ratio 100 %

Importance

Changes 0
Metric Value
eloc 1
dl 1
loc 1
rs 9.3333
c 0
b 0
f 0
cc 5
1
!function(t,r){"object"==typeof exports&&"undefined"!=typeof module?r(exports):"function"==typeof define&&define.amd?define(["exports"],r):r((t=t||self).arrayHelpers={})}(this,function(t){function r(t,r){for(var n=0;n<r.length;n++){var e=r[n];e.enumerable=e.enumerable||!1,e.configurable=!0,"value"in e&&(e.writable=!0),Object.defineProperty(t,e.key,e)}}function n(t,n,e){return n&&r(t.prototype,n),e&&r(t,e),t}function e(t){return(e=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}function i(t,r){return(i=Object.setPrototypeOf||function(t,r){return t.__proto__=r,t})(t,r)}function o(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],function(){})),!0}catch(t){return!1}}function u(t,r,n){return(u=o()?Reflect.construct:function(t,r,n){var e=[null];e.push.apply(e,r);var o=new(Function.bind.apply(t,e));return n&&i(o,n.prototype),o}).apply(null,arguments)}function f(t){var r="function"==typeof Map?new Map:void 0;return(f=function(t){if(null===t||-1===Function.toString.call(t).indexOf("[native code]"))return t;if("function"!=typeof t)throw new TypeError("Super expression must either be null or a function");if(void 0!==r){if(r.has(t))return r.get(t);r.set(t,n)}function n(){return u(t,arguments,e(this).constructor)}return n.prototype=Object.create(t.prototype,{constructor:{value:n,enumerable:!1,writable:!0,configurable:!0}}),i(n,t)})(t)}var c=function(){function t(t,r){this.key=t,this.moveDirection="desc"===r?-1:1}var r=t.prototype;return r.order=function(t){return t.sort(this.compare.bind(this))},r.compare=function(t,r){var n=t[this.key],e=r[this.key];return"string"==typeof n&&(n=n.toUpperCase()),"string"==typeof e&&(e=e.toUpperCase()),n<e?-1*this.moveDirection:n>e?1*this.moveDirection:0},t.create=function(r,n,e){return new t(n,e).order(r)},t}();function s(t,r,n){return c.create(t,r,n)}function a(t){return"object"!=typeof t||t.length<1?null:t.reduce(function(t,r){return Math.min(t,r)})}function h(t){return"object"!=typeof t||t.length<1?null:t.reduce(function(t,r){return Math.max(t,r)})}var l=function(){function t(t,r){this.find=t,this.operator=r||null}var r=t.prototype;return r.check=function(t){return Array.isArray(this.find)?this.checkOperators(t,this.find.indexOf(t)<0):this.checkOperators(t,String(t)!==String(this.find))},r.checkOperators=function(t,r){var n=h(this.find),e=a(this.find),i=null!==n,o=null!==e;return r&&("!="===this.operator||"<>"===this.operator)||!r&&!this.operator||(t>n&&i||t>this.find)&&">"===this.operator||(t>=n&&i||t>=this.find)&&">="===this.operator||(t<e&&o||t<this.find)&&"<"===this.operator||(t<=e&&o||t<=this.find)&&"<="===this.operator},t.create=function(r,n,e,i){var o=new t(e,i);return r.filter(function(t){var r=t[n];return!!r&&(r=r.toString().split(",")).some(o.check.bind(o))})},t}();function p(t,r,n,e){return l.create(t,r,n,e)}function y(t,r){return t.map(function(t){var n={};return"object"==typeof r?(r.forEach(function(r){n[r]=t[r]}),n):t[r]})}function d(t,r,n){return t.filter(function(t){return n?r.reduce(function(r,n){return n.indexOf(t)>=0?r+1:r},0)===r.length:r.indexOf(t)>=0})}var g=function(){function t(t,r,n){this.currentArray=t,this.otherArray=r,this.total=n}return t.create=function(r,n,e){return new t(r,n,e).compare},n(t,[{key:"differenceArray",get:function(){var t=this;return this.currentArray.filter(function(r){return t.otherArray.indexOf(r)<0})}},{key:"differenceArrayB",get:function(){var t=this;return this.total?this.otherArray.filter(function(r){return t.currentArray.indexOf(r)<0}):[]}},{key:"compare",get:function(){return this.differenceArray.concat(this.differenceArrayB)}}]),t}();function m(t,r,n){return g.create(t,r,n)}function v(t){return t.filter(function(t,r,n){return n.indexOf(t)===r})}function b(t){return!Array.isArray(t)||t.length<1?null:t.reduce(function(t,r){return t+r},0)}function O(t){return!Array.isArray(t)||t.length<1?null:b(t)/t.length}function k(t){var r=t.length;return t[Math.floor(Math.random()*(r-0))+0]}function A(t,r,n){for(var e=r.split("."),i=t;e.length>0;){var o=e.shift();if(null==i||!Object.prototype.hasOwnProperty.call(i,o))return n;i=i[o]}return i}function x(t){return!Array.isArray(t)||t.length<1?null:t[0]}function j(t){return!Array.isArray(t)||t.length<1?null:t[t.length-1]}t.Arr=function(t){var r,e;function i(){return t.apply(this,arguments)||this}e=t,(r=i).prototype=Object.create(e.prototype),r.prototype.constructor=r,r.__proto__=e;var o=i.prototype;return o.multisort=function(t,r){return s(this[0],t,r)},o.multifilter=function(t,r,n){return p(this[0],t,r,n)},o.multikey=function(t){return y(this[0],t)},o.intersect=function(t,r){return d(this[0],t,r)},o.diff=function(t,r){return m(this[0],t,r)},o.pushIfNotExists=function(t){return this.indexOf(t)<0&&this.push(t),this.length},o.pushMultiple=function(t){return this.push.apply(this,t),this.length},o.pushMultipleIfNotExists=function(t){var r=this;return t.forEach(function(t){r.pushIfNotExists(t)}),r.length},o.getByKey=function(t,r){return A(this[0],t,r)},n(i,[{key:"unique",get:function(){return v(this[0])}},{key:"max",get:function(){return h(this[0])}},{key:"min",get:function(){return a(this[0])}},{key:"random",get:function(){return k(this)}},{key:"summ",get:function(){return b(this[0])}},{key:"average",get:function(){return O(this[0])}},{key:"first",get:function(){return x(this[0])}},{key:"last",get:function(){return j(this[0])}}],[{key:Symbol.species,get:function(){return Array}}]),i}(f(Array)),t.average=O,t.diff=m,t.first=x,t.getByKey=A,t.intersect=d,t.last=j,t.max=h,t.min=a,t.multifilter=p,t.multikey=y,t.multisort=s,t.random=k,t.summ=b,t.unique=v});
2
//# sourceMappingURL=helpers.umd.js.map
3